Fix fixed-point long multiplication used in time delta
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 28 Sep 2005 21:18:30 +0000 (22:18 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 28 Sep 2005 21:18:30 +0000 (22:18 +0100)
calculations. The carry flag was clobbered before it was
added to the result.

Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c
xen/arch/x86/time.c

index 1de1bb89c0405a6501bab912dde5bb3e45d217fd..793977fbd657c06d46371e3cbef0931d82c719d9 100644 (file)
@@ -186,8 +186,8 @@ static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
                "mov  %4,%%eax ; "
                "mov  %%edx,%4 ; "
                "mul  %5       ; "
-               "add  %4,%%eax ; "
                "xor  %5,%5    ; "
+               "add  %4,%%eax ; "
                "adc  %5,%%edx ; "
                : "=A" (product), "=r" (tmp1), "=r" (tmp2)
                : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
index 7e972bea9457d18137aa33a5c5c6a6e6991ac67a..e7202174f82aa9b3359ffe3cda6e1914bee9772a 100644 (file)
@@ -119,8 +119,8 @@ static inline u64 scale_delta(u64 delta, struct time_scale *scale)
         "mov  %4,%%eax ; "
         "mov  %%edx,%4 ; "
         "mul  %5       ; "
-        "add  %4,%%eax ; "
         "xor  %5,%5    ; "
+        "add  %4,%%eax ; "
         "adc  %5,%%edx ; "
         : "=A" (product), "=r" (tmp1), "=r" (tmp2)
         : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (scale->mul_frac) );